package _72

func getDescentPeriods(prices []int) int64 {
	seqLen := 1
	var result int64
	for i := 0; i < len(prices); i++ {
		if i+1 < len(prices) && prices[i]-1 == prices[i+1] {
			seqLen++
		} else {
			result += int64(seqLen * (seqLen + 1) / 2)
			seqLen = 1
		}
	}
	return result
}
